import React, {Component} from 'react';
// import qs from 'qs'

const data = [
    {
        id: '01',
        content: '你好，中国'
    },
    {
        id: '02',
        content: '你好，哈哈哈哈'
    },
    {
        id: '03',
        content: '你好，嘿嘿嘿'
    }
]

class Index extends Component {
    render() {
        // 接收params参数
        // const {id, title} = this.props.match.params
        //接收search参数
        // const {search} = this.props.location
        // const {id, title} = qs.parse(search.slice(1))
        //接收state参数
        const {id, title} = this.props.location.state || {}
        const findResult = data.find(item => {
            return item.id === id
        }) || {}
        return (
            <ul>
                <li>ID:{id}</li>
                <li>TITLE:{title}</li>
                <li>CONTENT:{findResult.content}</li>
            </ul>
        );
    }
}

export default Index;